PROXY_EXE_FULL_PATH=E:\polipo\polipo.exe
PROXY_BAT_FILE=polipo-run.bat
PROXY_CONF_FILE=polipo.conf
PROXY_DNS_FILE=polipo-resolv.conf
PROXY_WWW_FILE=polipo-www.html

;SplitPath, InputVar [, OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive]
SplitPath, PROXY_EXE_FULL_PATH, PROXY_EXE_FILE, PROXY_PATH, , , ROOT_DRIVE
;>>PROXY_EXE_FILE=polipo.exe
;>>PROXY_PATH=E:\polipo
;>>ROOT_DRIVE=E:

PROXY_DNS_DIR=%ROOT_DRIVE%/etc
PROXY_CACHE_DIR=%PROXY_PATH%/cache
PROXY_WWW_DIR=%PROXY_PATH%/www

;FileCreateDir, DirName
FileCreateDir, %PROXY_DNS_DIR%
FileCreateDir, %PROXY_CACHE_DIR%
FileCreateDir, %PROXY_WWW_DIR%

;FileCopy, SourcePattern, DestPattern [, Flag]
FileCopy, %A_ScriptDir%/%PROXY_BAT_FILE%, %PROXY_PATH%, 1
FileCopy, %A_ScriptDir%/%PROXY_CONF_FILE%, %PROXY_PATH%, 1
FileCopy, %A_ScriptDir%/%PROXY_DNS_FILE%, %PROXY_DNS_DIR%/resolv.conf, 1
FileCopy, %A_ScriptDir%/%PROXY_WWW_FILE%, %PROXY_WWW_DIR%/index.html, 1

if (ErrorLevel <> 0)
{
    MsgBox %ErrorLevel% could not be copied.
    return
}

;Run, Target [, WorkingDir, Max|Min|Hide|UseErrorLevel, OutputVarPID]
;Run, "%PROXY_PATH%/polipo.exe" -c "%PROXY_PATH%/%PROXY_CONF_FILE%", %PROXY_PATH%
Run, "%PROXY_PATH%/%PROXY_BAT_FILE%", %PROXY_PATH%